import javax.swing.JOptionPane;

public class JMyClass02 {
    public JMyClass02() {
        if (JOptionPane.showConfirmDialog(null, "Deseas que te salude", "Hola", 
            JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE) == JOptionPane.YES_OPTION){
            
            JOptionPane.showMessageDialog(null, "Te saludo cordialmente");   
        }else{
            JOptionPane.showMessageDialog(null, "No te voy a saludar");   
        }   
    }

    public static void main(String[] args) {
        JMyClass02 jMyClass02 = new JMyClass02();
    }
}
